package com.minimalist.common.entity.lindi.vo.tradeapplicationtemplateconfirmletter;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @author 11987
 */
@Schema(name = "林地指标交易平台_交易申请确认函模板实体")
public class LindiTradeApplicationTemplateConfirmLetterVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "确认函模板ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "templateConfirmLetterId", description = "确认函模板ID", type = "string")
    private Long templateConfirmLetterId;

    @NotNull(message = "交易申请ID不能为空", groups = {Add.class, Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "tradeApplicationId", description = "交易申请ID", type = "string")
    private Long tradeApplicationId;

    @Schema(name = "confirmLetterType", description = "确认函类型", type = "string")
    private String confirmLetterType;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "fileId", description = "文件ID", type = "string")
    private Long fileId;

    @Schema(name = "file", description = "确认函模板文件")
    private FileVO file;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiTradeApplicationTemplateConfirmLetterVO(){
    }

    public LindiTradeApplicationTemplateConfirmLetterVO(Long templateConfirmLetterId, Long tradeApplicationId, String confirmLetterType, Long fileId, FileVO file, Long createId, Long updateId, LocalDateTime createTime, LocalDateTime updateTime){
        this.templateConfirmLetterId = templateConfirmLetterId;
        this.tradeApplicationId = tradeApplicationId;
        this.confirmLetterType = confirmLetterType;
        this.fileId = fileId;
        this.file = file;
        this.createId = createId;
        this.updateId = updateId;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public Long getTemplateConfirmLetterId(){
        return templateConfirmLetterId;
    }

    public void setTemplateConfirmLetterId(Long templateConfirmLetterId){
        this.templateConfirmLetterId = templateConfirmLetterId;
    }

    public Long getTradeApplicationId(){
        return tradeApplicationId;
    }

    public void setTradeApplicationId(Long tradeApplicationId){
        this.tradeApplicationId = tradeApplicationId;
    }

    public String getConfirmLetterType(){
        return confirmLetterType;
    }

    public void setConfirmLetterType(String confirmLetterType){
        this.confirmLetterType = confirmLetterType;
    }

    public Long getFileId(){
        return fileId;
    }

    public void setFileId(Long fileId){
        this.fileId = fileId;
    }

    public FileVO getFile(){
        return file;
    }

    public void setFile(FileVO file){
        this.file = file;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }

        LindiTradeApplicationTemplateConfirmLetterVO that = (LindiTradeApplicationTemplateConfirmLetterVO) o;

        if (!Objects.equals(templateConfirmLetterId, that.templateConfirmLetterId)){
            return false;
        }
        if (!Objects.equals(tradeApplicationId, that.tradeApplicationId)){
            return false;
        }
        if (!Objects.equals(confirmLetterType, that.confirmLetterType)){
            return false;
        }
        if (!Objects.equals(fileId, that.fileId)){
            return false;
        }
        if (!Objects.equals(file, that.file)){
            return false;
        }
        if (!Objects.equals(createId, that.createId)){
            return false;
        }
        if (!Objects.equals(updateId, that.updateId)){
            return false;
        }
        if (!Objects.equals(createTime, that.createTime)){
            return false;
        }
        return Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        int result = templateConfirmLetterId != null ? templateConfirmLetterId.hashCode() : 0;
        result = 31 * result + (tradeApplicationId != null ? tradeApplicationId.hashCode() : 0);
        result = 31 * result + (confirmLetterType != null ? confirmLetterType.hashCode() : 0);
        result = 31 * result + (fileId != null ? fileId.hashCode() : 0);
        result = 31 * result + (file != null ? file.hashCode() : 0);
        result = 31 * result + (createId != null ? createId.hashCode() : 0);
        result = 31 * result + (updateId != null ? updateId.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }
}
